<script>
	export default {
        // 全局变量，存放token和source
        globalData: {
            token: '',
            nickName: '',
            avatarUrl: '',
            gender: '',
            phoneno: '',
            userId: '',
            tags: []
        },
        
        onLaunch: function(params) {
			console.warn('当前组件仅支持 uni_modules 目录结构 ，请升级 HBuilderX 到 3.1.0 版本以上！')
			console.log('load_params = ' + JSON.stringify(params))
            if (params.query.tag) {
                this.globalData.tags = [];
                this.globalData.tags.push(params.query.tag);
            }
		},
		onShow: function() {
			console.log('App Show')

            const that = this
            uni.getStorage({
                key: 'user_login_key',
                success: (res) => {
                    const data = res.data || {};
                    getApp().globalData.token = data.token || ''
                    getApp().globalData.nickName = data.nickName || ''
                    getApp().globalData.avatarUrl = data.avatarUrl || ''
                    getApp().globalData.gender = data.gender || ''
                    getApp().globalData.userId = data.userId || ''
                    getApp().globalData.phoneno = data.phoneno || ''
                    console.log(getApp().globalData);
                }
            })
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

<style lang="scss">
	/*每个页面公共css */
	@import '@/uni_modules/uni-scss/index.scss';
	@import '@/common/uni.scss';
	@import '@/common/uni-ui.scss';
	/* #ifndef APP-NVUE */
	@import '@/static/customicons.css';
	// 设置整个项目的背景色
	page {
		background-color: #f5f5f5;
	}
	uni-page-body,#app{
		height: 100%;
	}
	/* #endif */
	.example-info {
		font-size: 14px;
		color: #333;
		padding: 10px;
	}
</style>
